const state = {
  associatedRowList: new Map(),
  showModal: false
}
const mutations = {
  /* 关联 */
  ASSOCIATED_GOODS: (state, data) => {
    let { row, type } = data
    let name = type || 'skuNo'
    state.associatedRowList.set(row[name], row)
  },
  /* 取消关联 */
  CANCEL_GOODS: (state, data) => {
    let { row, type } = data
    let name = type || 'skuNo'
    state.associatedRowList.delete(row[name])
  },
  /* 打开或关闭弹框 */
  CHANGE_MODAL_SWITCH: (state, data) => {
    state.showModal = data
  },
  /* 清空 */
  CLEAR_GOODS: (state, data) => {
    state.associatedRowList.clear()
  },
  /* 所有state状态都清空 */
  DESTORY_STATE: (state, data) => {
    state.associatedRowList.clear()
    state.showModal = false
  }
}
export default {
  namespaced: true,
  state,
  mutations
}
